import numpy as np
import matplotlib.pyplot as plt
import barker
import barkerpair

def plot_barker_autocorrelation(barker_code):
    plt.stem(range(len(barker_code)), barker.get_autocorrelation(barker_code))
    plt.xlabel('Lag')
    plt.ylabel('Autocorrelation')
    plt.title('Autocorrelation of Barker code')
    plt.show()

def plot_barker_pair_autocorrelation(barker_code_pair):
    plt.stem(range(len(barker_code_pair[0])), barkerpair.get_autocorrelation(barker_code_pair))
    plt.xlabel('Lag')
    plt.ylabel('Autocorrelation')
    plt.title('Autocorrelation of Barker code pair')
    plt.show()

if __name__ =='__main__':
    plot_barker_autocorrelation([1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1, 1])
    plot_barker_pair_autocorrelation([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1, -1],[-1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1]])